home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-20 / rs0422.zip / LEVEL1 / BOOT.AS next >
Text File  |  1989-12-09  |  7KB  |  216 lines

  1. ;/*
  2. ; * Copyright 1988 by the Radio Amateur Telecommunications Society
  3. ; * and Thomas A. Moulton, W2VY
  4. ; *
  5. ; * This software may only be modified, copied, distributed or
  6. ; * executed for non-profit purposes by individuals operating
  7. ; * systems in the Amateur Radio Service.  Credit to the
  8. ; * author(s) and to the Radio Amateur Telecommunications Society
  9. ; * must be made in modules where RATS provided software is used,
  10. ; * and in any announcements and documentation.  
  11. ; *
  12. ; * As a non-profit, research and development organization,  the
  13. ; * Radio Amateur Telecommunications Society distributes software
  14. ; * in both executable and source forms.  This policy is in place
  15. ; * to encourage the development and distribution of OSI-based,
  16. ; * networking tools.  In order to protect the interests of the
  17. ; * Society and the authors, we have placed some conditions
  18. ; * of use on the software.  Other groups are encouraged
  19. ; * to place the same or similar guidelines on
  20. ; * software they produce.
  21. ; *
  22. ; * The Radio Amateur Telecommunications Society reserves the right
  23. ; * to specify and alter the terms under which software provided by
  24. ; * the Society may be used.  This policy is consistent with the 
  25. ; * objective of uniform and consistent "Open Systems Interconnections."
  26. ; * 
  27. ; * All acceptable Amateur Radio related uses of this software
  28. ; * will be outlined in the "ROSE Implementer's Guide".  Individuals
  29. ; * or organizations wishing to add to, or modify the provisions of
  30. ; * the guide to accommodate local or evolutionary requirements
  31. ; * should document the proposed change(s) and forward them to the
  32. ; * Society.  If accepted, written notification will be provided by
  33. ; * the Society to the submitting organization or individual(s).
  34. ; * The Society will then issue a "ROSE Implementer's Guide Change
  35. ; * Notice".  Periodically, the Society will re-issue the "ROSE 
  36. ; * Implementer's Guide" and incorporate the text of the change 
  37. ; * notices.  This procedure has been put in to place to ensure
  38. ; * compatibility between systems and to ensure their "Openness"
  39. ; * and interoperability.
  40. ; *
  41. ; * No part of this software may be used in other packages 
  42. ; * without prior authorization from the author or the Society.  
  43. ; * Software incorporating this module, all or in part, must be 
  44. ; * provided to the Society prior to distribution or use by
  45. ; * anyone not directly involved in testing of the revised  
  46. ; * environment.  Current releases of the combined software must
  47. ; * be provided to the Society in both source and executable
  48. ; * forms.  Adequate documention to produce an executable module 
  49. ; * from the provided source must also be included.
  50. ; *
  51. ; * Non-Amateur Radio non-profit uses may be authorized on a case
  52. ; * by case basis.  Inquiries for such use may be made in writing
  53. ; * to the Society. Non-commercial uses consistent with the
  54. ; * general principles of Open Systems Interconnection Reference
  55. ; * Model will be generally considered with favor.
  56. ; *
  57. ; * Commercial licensing of the software is also available based
  58. ; * on normal commercial terms.  Licensing inquiries should be
  59. ; * directed to the Society.  Commercial licensing of the standard
  60. ; * software will be done in situations which materially benefit
  61. ; * the Amateur Radio Packet Network.  Additional licensing is
  62. ; * reserved by the individual authors.
  63. ; * 
  64. ; * The Radio Amateur Telecommunications Society provides this software
  65. ; * on an "as is" basis.  The Society assumes no liability for
  66. ; * loss incurred through the use of this software.  Amateur Radio
  67. ; * use of this software implies non-commercial and voluntary 
  68. ; * development, deployment and use of this software in a "Amateur",
  69. ; * non-commercial service.  Commercial users are encouraged to
  70. ; * inspect their copies of the source code.  Source code modification
  71. ; * licenses are available if a combined Object and Source Code
  72. ; * license was not originally established.
  73. ; * 
  74. ; * The Society may be contacted by writing or calling at:
  75. ; * 
  76. ; * The Radio Amateur Telecommunications Society 
  77. ; * 206 North Vivyen Street.
  78. ; * Bergenfield, New Jersey 07621
  79. ; *
  80. ; * Telephone: 201-387-8896
  81. ; *
  82. ; */
  83. ;
  84. ; System Init for ROM
  85. ;
  86. *INCLUDE RCONFIG.LIB
  87.  
  88.     psect    text
  89.  
  90.     global    __init, _MEMSIZ, _COLD
  91.     global    _main, start, __Hbss, __Lbss, __Lbssck
  92.     global    HDWINT, QUEUE, csv, cret, rcsv
  93.  
  94.     global    mycall, mydigi, myaddr, _dl2parms
  95.     global    _dl3parms, _being_set, _complete
  96.  
  97. start:    DEFW    mycall, mydigi, myaddr, _dl2parms
  98.     DEFW    _dl3parms,_being_set,_complete,-1
  99.     DEFW    -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
  100.     DEFW    -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
  101.     DEFW    -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
  102.     DEFW    -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
  103.     DEFW    -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
  104.     DEFW    -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
  105.     DEFW    -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
  106.     DEFW    -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
  107.     DEFW    -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
  108.     DEFW    -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
  109.  
  110. ;The next location should be 0150H
  111.  
  112. INIT_HDW EQU    0004H
  113. INIT_LED EQU    0007H
  114. UPD_LED  EQU    000AH
  115.  
  116. POWER_FAIL:
  117.     LD    A,(_COLD)    ;Why are we here?
  118.     EX    AF,AF'        ;Save it in alt reg set
  119.     ld    hl,__Lbss    ;Start of RAM
  120.     ld    ix,0        ;checked 0 bytes so far
  121.     ld    b,0ffh
  122.     ld    c,0
  123. sizlop:    ld    (hl),0
  124.     ld    a,c
  125.     cp    (hl)
  126.     jp    nz,cleared    ;not RAM, done
  127.     dec    (hl)
  128.     ld    a,b
  129.     cp    (hl)
  130.     jp    nz,cleared    ;not RAM, done
  131.     ld    a,(__Lbssck)    ;Did memory wrap yet?
  132.     cp    b
  133.     jp    z,cleared    ;memory wrapped on itself
  134.     inc    ix        ;Count one more byte
  135.     ld    (hl),0        ;Clear it
  136.     inc    hl
  137.     jp    sizlop
  138.  
  139. cleared:
  140.     dec    hl
  141.     dec    hl
  142.     ld    sp,hl        ;Set stack to top of mem
  143.     push    ix        ;Save memsize (in IX) for later
  144.     pop    de
  145.     ld    hl,__Hbss
  146.     ld    bc,__Lbss
  147.     xor    a        ;Clear carry
  148.     sbc    hl,bc        ;RAM Used by the code
  149.     ex    de,hl
  150.     xor    a
  151.     sbc    hl,de        ;Total RAM for Heap/Stack
  152.     ld    (_MEMSIZ),hl    ;Save the Ram Size for _spclev()
  153.     ld    hl,NSLOT
  154.     ld    (QUEUE),hl    ;Init the QUEUE header for OS_TASK
  155.     ex    af,af'        ;Get Cold Start Flag
  156.     ld    (_COLD),a
  157.  
  158.     global    __init
  159.     call    __init
  160. ;
  161.     call    HDWINT
  162.     call    _main
  163.     XOR    A
  164.     LD    (_COLD),A    ;We did?! Error 00 (Both ON)
  165.     jp    start    ;it shouldn't ever return...
  166.  
  167.     global    _service_timers
  168.     global    _main, SETTMR
  169. _main:
  170.     LD    A,(_COLD)    ;Why did we restart?
  171.     LD    B,A        ;COLD=00h, Power Failure
  172.                 ;COLD=40h, Calling _free from OS_TASK (NOT USED)
  173.                 ;COLD=80h, Bad Vector in SETTMR/TICK
  174.                 ;COLD=C0h, Died while Running a process
  175.  
  176.     CALL    INIT_LED    ;Init the Led's based on A
  177.  
  178.     LD    A,0
  179.     LD    (_COLD),A    ;Toggle the LEDS in 3 Sec so we can see them
  180. ;
  181.     ld    de,0        ;No arg
  182.     ld    hl,timedone    ;routine
  183.     ld    bc,303        ;101 x 9.9ms ticks = 909ms (1 Sec) timer
  184.     ld    a,NUMCH        ;pseudo channel for the 1 sec timer
  185.     call    SETTMR
  186.  
  187.     global    _init
  188.     ld    hl,_init    ; init l2/l3
  189.     ld    a,0        ;no args
  190.     call    OS_QUE
  191.  
  192. 1:    call    OS_TASK
  193.     jp    1b
  194.  
  195.     global    OS_TASK, OS_QUE
  196. timedone:
  197.     ld    de,0        ;No arg
  198.     ld    hl,timedone    ;routine
  199.     ld    bc,101        ;101 x 9.9ms ticks = 909ms (1 Sec) timer
  200.     ld    a,NUMCH        ;pseudo channel for the 1 sec timer
  201.     call    SETTMR
  202.  
  203.     ld    hl,UPD_LED        ;Toggle LED's
  204.     ld    a,0            ;no args
  205.     call    OS_QUE            ;queue it to happen soon
  206.  
  207.     ld    hl,_service_timers    ;routine to call
  208.     ld    a,0            ;no args
  209.     call    OS_QUE            ;queue it to happen soon
  210.     ret
  211.  
  212.     psect    bss
  213.     global    HDWbss
  214. HDWbss:    defs    8        ;Some spare ram for machine dep...
  215.     end    0000
  216.